package com.klxedu.ms.gateway.security.client.service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class RoleMenu {

	private String roleID;
	private List<Menu> menuList;

	public String getRoleID() {
		return roleID;
	}

	public void setRoleID(String roleID) {
		this.roleID = roleID;
	}

	public List<Menu> getMenuList() {
		return menuList;
	}

	public void setMenuList(List<Menu> menuList) {
		this.menuList = menuList;
	}
	
	public List<MenuOperation> getMenuOptList(){
		
		List<MenuOperation> optList = new ArrayList<>();
		if(this.menuList == null || this.menuList.isEmpty()) {
			return Collections.emptyList();
		}
		for (Menu m : this.menuList) {
			if(m!=null && m.getOperationList()!=null) {
				optList.addAll(m.getOperationList());
			}
		}
		return optList;
	}

}
